package com.jinxin.platform.cdacsrecord.core.service.impl;

import com.jinxin.platform.cdacsrecord.core.pojo.domains.AcsControlDeviceSubscribe;
import com.jinxin.platform.cdacsrecord.core.mapper.JurenAcsControlDeviceSubscribeMapper;
import com.jinxin.platform.cdacsrecord.core.service.AcsControlDeviceSubscribeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * (AcsControlDeviceSubscribe)表服务实现类
 *
 * @author cyl
 * @since 2020-04-26 16:19:39
 */
@Service("acsControlDeviceSubscribeService")
public class AcsControlDeviceSubscribeServiceImpl implements AcsControlDeviceSubscribeService {
    @Resource
    private JurenAcsControlDeviceSubscribeMapper jurenAcsControlDeviceSubscribeMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public AcsControlDeviceSubscribe queryById(String id) {
        return this.jurenAcsControlDeviceSubscribeMapper.queryById(id);
    }


    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<AcsControlDeviceSubscribe> queryAllByLimit(int offset, int limit) {
        return this.jurenAcsControlDeviceSubscribeMapper.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param acsControlDeviceSubscribe 实例对象
     * @return 实例对象
     */
    @Override
    public AcsControlDeviceSubscribe insert(AcsControlDeviceSubscribe acsControlDeviceSubscribe) {
        this.jurenAcsControlDeviceSubscribeMapper.insert(acsControlDeviceSubscribe);
        return acsControlDeviceSubscribe;
    }

    /**
     * 修改数据
     *
     * @param acsControlDeviceSubscribe 实例对象
     * @return 实例对象
     */
    @Override
    public AcsControlDeviceSubscribe update(AcsControlDeviceSubscribe acsControlDeviceSubscribe) {
        this.jurenAcsControlDeviceSubscribeMapper.update(acsControlDeviceSubscribe);
        return this.queryById(acsControlDeviceSubscribe.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String id) {
        return this.jurenAcsControlDeviceSubscribeMapper.deleteById(id) > 0;
    }

    @Override
    public List<Map> selAllDevice() {
        return jurenAcsControlDeviceSubscribeMapper.selAllDevice();
    }

    @Override
    public List<AcsControlDeviceSubscribe> getAllDevice() {
        return jurenAcsControlDeviceSubscribeMapper.getAllDevice();
    }

    @Override
    public List<AcsControlDeviceSubscribe> getDeviceByAccount(String account) {
        return jurenAcsControlDeviceSubscribeMapper.getDeviceByAccount(account);
    }
}